package com.suxin.test.netty.adv;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import lombok.extern.slf4j.Slf4j;
import org.example.netty.adv.server.ServerInit;

/**
 * @Author: tang
 * @Description:
 * @Date 2025/1/21 09:38
 */
@Slf4j
public class NettyServer {

    public static void main(String[] args) throws Exception {

        NioEventLoopGroup bossGroup = new NioEventLoopGroup();
        ServerBootstrap serverBootstrap = new ServerBootstrap();

        ChannelFuture channelFuture = serverBootstrap.group(bossGroup)
                .channel(NioServerSocketChannel.class)
                .childHandler(new ServerInit()).bind(9999).sync();
        log.info("server runing...");
        channelFuture.channel().closeFuture().sync();
        log.info("server close...");
    }

}
